﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Service.Infrastructure.Result
{
    /// <summary>
    ///     通用处理结果
    /// </summary>
    public class BaseResult : ServiceResult
    {
        public BaseResult()
        {
            Code = ResultType.Error;
        }

        

        public override Object GetCode()
        {
            return ReCode;
        }

        public override void SetCode(object lgCode)
        {
            Code = (ResultType)lgCode;
        }

        public override Object GetData()
        {
            return ReData;
        }

        public override void SetData(Object lgdata)
        {
            Data = lgdata;
        }

        [Obsolete]
        public override bool GetSuccess()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        ///     获取处理结果文字信息
        /// </summary>
        /// <returns></returns>
        public override string GetMsg()
        {
            if (CodeMagsDict.ContainsKey(Code))
            {
                return CodeMagsDict[Code];
            }
            throw new Exception(KeyIsNotFound);
        }
    }
}
